
/* ********************************************************************************************
*  Alvin Baldemeca
*  Tetris Project
*  Course: TCSS 305 , Alan Fowler
*  Term: Spring 2012
*  UNIVERISTY OF WASHINGTON TACOMA
*
*
**********************************************************************************************/

package gui.actions;


import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;


import javax.swing.AbstractAction;
import javax.swing.Action;

import view.TetrisGUI;


/**
 *This action tells a Board to move a tetris piece down.
 *@author Alvin Baldemeca
 * @version 5/25/2012
 */
@SuppressWarnings("serial")
public class LoadAction extends AbstractAction
{
  /**
   * The tetris GUI to load into the game.
   */
  private final TetrisGUI my_tetris_gui;
  
  /**
   * Constructs a DownAction.
   * @param the_tetris_gui The tetris GUI to load into the game.
   */
  public LoadAction(final TetrisGUI the_tetris_gui) 
  {
    super("Load");
    putValue(Action.MNEMONIC_KEY, KeyEvent.VK_L);
    putValue(Action.SELECTED_KEY, true);
    my_tetris_gui = the_tetris_gui;
  }

  @Override
  public void actionPerformed(final ActionEvent the_event) 
  {
    final int last_item_index = my_tetris_gui.getMyBoardList().size() - 1;
    my_tetris_gui.loadBoard(last_item_index);
  }
  

}